from matplotlib import pyplot as plt
from matplotlib import font_manager
import random

x_3 = range(1,32)
x_10=range(51,82)
y_3 = [random.randint(11,23) for i in range(31)]
y_10 = [random.randint(10,30) for i in range(31)]

plt.rcParams['font.sans-serif']=['SimHei']#显示中文标签
plt.rcParams['axes.unicode_minus']=False
my_font=font_manager.FontProperties(fname="C:\Windows\Fonts\simsun.ttc")

plt.figure(figsize=(20,8),dpi=80)

plt.scatter(x_3,y_3,color="red",label="3月")
plt.scatter(x_10,y_10,color="gray",label="10月")

_x=list(x_3)+list(x_10)
_xtick_lables=["3月{}日".format(i) for i in x_3]
_xtick_lables+=["10月{}日".format(i) for i in x_3]
plt.xticks(_x,_xtick_lables,rotation=45,fontproperties=my_font)

plt.xlabel("月份",fontproperties=my_font)
plt.ylabel("温度 (℃)",fontproperties=my_font)
plt.title("气温图",fontsize=20,fontproperties=my_font)

plt.legend(prop=my_font,loc=5)

plt.show()